package com.bbs.db.impl;

import com.bbs.db.iface.ModerinfoDao;
import com.bbs.db.pers.Moderinfo;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * @time Nov 12, 2009, 9:19:59 PM
 * @author fdcube
 */
public class ModerinfoImpl extends HibernateDaoSupport implements ModerinfoDao {

    public boolean AddModerator(Moderinfo value) {
        try {
            this.getHibernateTemplate().save(value);
            return true;
        } catch (DataAccessException dataAccessException) {
            logger.error(dataAccessException);
            return false;
        }
    }

    public boolean DeleteModerator(Moderinfo value) {
        try {
            Moderinfo mtmp = this.getHibernateTemplate().get(Moderinfo.class, value.getMid());
            this.getHibernateTemplate().delete(mtmp);
            System.out.println("数据层删除版主成功");
            return true;
        } catch (DataAccessException dataAccessException) {
            System.out.println("数据层删除版主失败" + dataAccessException);
            logger.error(dataAccessException);
            return false;
        }
    }
}
